package com.traffic.controller.login;

import com.ainsurtech.proxy.Response;
import com.traffic.entity.User;
import com.traffic.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private UserService service;


    /**
     * 根据id查询
     *
     * @return
     */



    @RequestMapping(method = RequestMethod.POST)
    public Response<User> find(@RequestBody UserDTO r) throws Exception {
       return new Response<>(service.findUserByNameAndPassword(r.getName(),r.getPassword()));
    }


}
